﻿using Microsoft.AspNetCore.Mvc;
using MyToDo.Api.Controllers.Dtos;
using MyToDo.Api.Service;
using System.Threading.Tasks;

namespace MyToDo.Api.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class LoginController : ControllerBase
    {
        private readonly ILoginService loginService;

        public LoginController(ILoginService loginService)
        {
            this.loginService = loginService;
        }
        [HttpPost]
        //public async Task<ApiResponse> Login(string account,string password) => await loginService.LoginAsync(account, password);
        public async Task<ApiResponse> Login([FromBody] UserDto dto) => await loginService.LoginAsync(dto);
        [HttpPost]
        public async Task<ApiResponse> Resgiter([FromBody] UserDto user) => await loginService.ResgiterAsync(user);
    }
}
